(function($){ 
	
	// 对外公布的方法
    var methods =
    {
    	// 数据序列化
	    serialize: function(prefix)
	    {
	    	var obj = new Object();
	    	var attrName = "";
	    	$(this).find('input').each(function (){
	    		attrName = $(this).attr("data-id");
	    		obj[prefix + attrName] = $(this).val();
	    	});
	    	$(this).find('textarea').each(function (){
	    		attrName = $(this).attr("data-id");
	    		obj[prefix + attrName] = $(this).val();
	    	});
	    	$(this).find('select').each(function (){
	    		attrName = $(this).attr("data-id");
	    		obj[prefix + attrName] = $(this).val();
	    	});
	    	return obj;
	    },

	    //数据回显
	    render: function(obj ,prefix)
	    {
	    	if (!obj)
	    	{
	    		return false;
	    	}
	    	for (var attrName in obj)
	    	{
	    		$(this).find("input[data-id="+attrName+"]").val(obj[attrName]);
	    		$(this).find("select[data-id="+attrName+"]").val(obj[attrName]);
	    		$(this).find("textarea[data-id="+attrName+"]").val(obj[attrName]);
	    		$(this).find("label[data-id="+attrName+"]").text(beautyNull(obj[attrName]));
	    		$('input:radio[name='+attrName+'][value="'+obj[attrName]+'"]').attr("checked",'checked');
	    	}
	    }

    };
	
	$.fn.umDataBind = function(options ,prefix){
        if (methods[options]) {
            return methods[options].apply(this, Array.prototype.slice.call(arguments, 1));
        }
        return null;
	};
})(jQuery);